# Ctrl + R to execute the code # Ctrl + L to delete the R console # putting # on the left of any thing will make it a comment 1+1# this is how you add up different numbers 2*2 1+1 # 2+2 1+1 * 2+2 ## vector is an unidimensional a <- 1 ## this is how you create a vector a a <- 1:5 ## vector with consecutive numbers a a <- c(1,3,5) ## vector with different numbers c means "combine" a b <- "a" # put "" around character b b <- c("a","b","c","abc") b # this is how you check the property of a vector class(a)# numeric class(b)# character c <- factor(c(1,2,3))# factor; different type of property is.numeric(a)# questions if it's a numeric a <- as.character(a)# converts into character d <- c(1,2,3,"Subhojit")## character has priority name <- c("A","B","C","D","E","F","G","H","I","J") age <- c(22,43,12,17,29,5,51,56,9,44) sex <- c("M","F","M","M","M","F","F","M","F","F") undertaker <- data.frame(name,age,sex,stringsAsFactors=FALSE) undertaker str(undertaker)# view the properties #data frame name $ variable name undertaker$name <- as.character(undertaker$name) undertaker$sex <- as.character(undertaker$sex) rock <- undertaker